package ch02;

/**
 * Employee has as a name and a salary. 
 * The salary can be changed by the raiseSalary method.
 * 
 * @author Peter Tolstrup Aagesen
 * 
 * Exercise #2.16
 */
public class Employee {
	
	//String variable containing the employees name
	private String name;
	
	//double variable containing the employees salary
	private double salary;
	
	/**
	 * Basic constructor taking no arguments
	 */	
	public Employee()
	{
		//assign default values to variables
		name = "";
		salary = 0.0;
	}
	
	/**
	 * Constructs Employee with name and salary
	 * @param employeeName the name of the employee
	 * @param currentSalary the initial salary of the employee
	 */
	public Employee(String employeeName, double currentSalary)
	{
		this();
		
		//pass value to the name variable
		name = employeeName;
		
		//assign value to the salary variable
		salary = currentSalary;
	}
	
	/**
	 * Raise the salary of the employee by a certain percent
	 * @param byPercent Number of percent the salary raises
	 */
	public void raiseSalary(double byPercent){
		//translate myPercent to at decimal number
		double percentAsDecimalNumber = byPercent * 0.01;
		//create a factor to multiply salary with to get the raised salary
		double percentFactor = 1d + percentAsDecimalNumber;
		
		//Calculate the new salary
		salary *= percentFactor;	
	}
	
	/**
	 * Getter for the name.
	 * @return Returns the employees name
	 */
	public String getName(){
		return name;
	}
	
	/**
	 * Getter for the salary
	 * @return Returns the current salary
	 */	
	public double getSalary(){
		return salary;
	}
	
}
